from PyQt5.QtWidgets import QApplication, QWidget, QLineEdit, QVBoxLayout, QTextEdit
from PyQt5.QtCore import *
from PyQt5.QtGui import QIcon
import sys


def init_widget(w: QWidget):
    # 修改窗口标题
    w.setWindowTitle('多行输入框')
    # 设置窗口大小
    w.resize(480, 320)

    layout = QVBoxLayout()

    """------------------ 多行输入框 ------------------"""
    edit = QTextEdit()

    # 设置提示内容
    # edit.setPlaceholderText('请输入发表的内容')
    # 设置文本内容
    edit.setPlainText('武汉疫情')
    # 获取输入的内容
    # print(edit.toPlainText())
    edit.clear()

    # 显示多行输入框
    layout.addWidget(edit)

    w.setLayout(layout)


if __name__ == '__main__':
    # 1.创建应用程序
    app = QApplication(sys.argv)
    # 2.创建窗口
    w = QWidget()

    init_widget(w)

    # 3.显示窗口
    w.show()

    # 4.等待窗口停止
    sys.exit(app.exec())
